<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ page isELIgnored="false"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet"
	href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css"
	integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
	crossorigin="anonymous">
<link rel="stylesheet"
	href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap-theme.min.css"
	integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp"
	crossorigin="anonymous">
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.js"></script>
<script
	src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"
	integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
	crossorigin="anonymous"></script>

	<%@include file="toolbar.jsp"%>
	<script src="${ctx}/assets/js/ajax.js"></script>
	<script src="${ctx}/assets/js/dish.js"></script>
	<title>管理菜品</title>
	<style type="text/css">
		table { border-collapse:collapse; border:solid 1px black;width:600px; }
        table th, table td { height:20px; border:solid 1px Black; padding: 10px; }
        td img { height: 100px; }
        .wrapper{
        	width:700px;
        	margin:0 auto;
        }
        
         .show{
        	margin-left:-800px;
        }
	</style>
</head>
<body>
	<div id="show">
		<a style="margin-left:-600px;" href="../home">&lt;&lt; 返回首页</a>
		
	</div>
	<div class="wrapper">
	
	<form class="form-inline" action="" method="post">
<select id="dtype" name="dtype" class="form-control">
<c:forEach items="${ dishTypes }" var="t">
<option value="${ t.dishTypeNum }" ${ param.dtype eq t.dishTypeNum ? "selected=\"selected\"" : "" }>${ t.dishTypeName }</option>
</c:forEach>
</select>
<input id="dname" type="text" class="form-control" placeholder="输入菜名" name="dname" value="${ param.dname }" />
<input class="btn btn-default" type="button" value="搜索" id="searchDish"/>

<br><br><a style="margin-left:-600px;"class="btn btn-default" role="button" href="add">新增菜品</a><br>
</form>

	
	<table class="table-bordered">
		<thead>
			<tr>
				<th>预览</th>
				<th>名称</th>
				<th>类型</th>
				<th>价格</th>
				<th></th>
				<th></th>
			</tr>
		</thead>
		<tbody id="dishbody">
		
			<c:forEach items="${ dishes }" var="d" varStatus="status">
				<tr>
					<td><img src="../../local/${ d.dImage }"/></td>
					<td>${ d.dName }</td>
					<td>${ dishTypes.get(d.dType).dishTypeName }</td>
					<td>${ d.dPrice }</td>
					<td><a href="update?dId=${ d.dId }">更新</a></td>
					<td> <button dish_id=${ d.dId }>delete</button> </td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
	</div>
</body>
</html>